#include<iostream>
#include<stack>
using namespace std;

int main()
{
    stack<int> st;
    cout << "请输入要转化进制的数字：";
    int num = 0;
    cin >> num;
    cout << "请输入要转化为几进制：";
    int m = 0;
    cin >> m;
    while (num)
    {
        st.push(num%m);
        num /= m;
    }
    while (!st.empty())
    {
        cout << st.top();
        st.pop();
    }
    cout << endl;
    return 0;
}
